﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace WinnerCMS.Data.Mapping
{
    public partial class MemuMap
        : EntityTypeConfiguration<WinnerCMS.Model.Memu>
    {
        public MemuMap()
        {
            // table
            //ToTable("CMS_Memu");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasMaxLength(36).IsUnicode(false)
                .IsRequired();
            Property(t => t.Title)
                
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.Link)
                .IsUnicode(false)
                .HasMaxLength(255)
                .IsRequired();
            Property(t => t.Pid)
                .IsUnicode(false)
                .HasMaxLength(36)
                .IsRequired();
            Property(t => t.RootId)
                
                .IsRequired();
            Property(t => t.OrderId)
                
                .IsRequired();
            Property(t => t.BaseModel)
                .IsUnicode(false)
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.IsOpen)
                
                .IsRequired();
            Property(t => t.ModelId)
                
                .IsOptional();
            Property(t => t.LowestRightCode)
                
                .IsOptional();
            // Relationships
            HasOptional(t => t.Model)
           .WithMany(t => t.Memus)
           .HasForeignKey(d => d.ModelId);
            
            //InitializeMapping();
        }
    }
}

